package com.platform.usercenter.config;


import com.platform.usercenter.domain.SysAutoCodePart;
import com.platform.usercenter.enums.PartTypeEnum;
import com.platform.usercenter.service.PartTypeTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class PartTypeHandler {

    @Resource
    List< PartTypeTemplate > partTypeTemplates;

    public String choiceExecute( SysAutoCodePart sysAutoCodePart){
        String partType = sysAutoCodePart.getPartType();
        return partTypeTemplates.get( PartTypeEnum.getByCode(partType).getBeanIndex()).partHandle(sysAutoCodePart);
    }

}
